<template>
  <el-form :label-position="labelPosition" label-width="80px" :model="formInline">
    <el-form-item label="商品名称">
      <el-input v-model="formInline.gname"></el-input>
    </el-form-item>
    <el-form-item label="仓库名称">
      <el-input v-model="formInline.sName"></el-input>
    </el-form-item>
    <el-form-item label="数量">
      <el-input v-model="formInline.number"></el-input>
    </el-form-item>
    <el-form-item label="单价">
      <el-input v-model="formInline.price"></el-input>
    </el-form-item>
    <el-form-item label="总金额">
      <el-input v-model="formInline.sumPrice"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">确认出库</el-button>
      <el-button @click="black">返回</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: "Delivery",
  data() {
    return {
      labelPosition: 'right',
      formInline: {
        gname: '',
        sName: '',
        price:'',
        sumPrice:'',
        number:'',
      },
    };
  },
  created() {
    const row=this.$route.params.row;

    console.log(this.$route.params);
  },
  methods:{
    onSubmit(){
      var vm = this
      this.axios({
        method:"POST",
        url:"/api/inventory/update",
        data:{
          gname:vm.formInline.gname,
          sName:vm.formInline.sName,
          price:vm.formInline.price,
          sumPrice:vm.formInline.sumPrice,
          number:vm.formInline.number
        }
      }).then(function (res){
        if(res.data.code == 200){
          vm.$message(res.data.msg)
        }else{
          vm.$message(res.data.msg)
        }
      })
    },
    black(){
      this.$router.push('/inventory/List')
    }
  }
}
</script>

<style scoped>

</style>
